﻿
using System;
using UnityEngine;
using UnityEngine.InputSystem;

namespace Gameplay.CharacterFramework
{
    public class AnimationComponent:CoreComponent
    {
        [SerializeField]private Animator _animator;
        public Animator Anim => _animator;

        private Role _role;
        protected override void Awake()
        {
            base.Awake();
            _role=GetComponentInParent<Role>();
        }
        public void SetFloat(string name,float value) 
        {
            _animator.SetFloat(name, value);
        }

        public void SetFloat(string name, float value,float dampTime,float deltaTime)
        {
            _animator.SetFloat(name, value,dampTime,deltaTime);
        }

        public void SetBool(string name, bool value)
        {
            _animator.SetBool(name, value);
        }

        public void SetInteger(string name, int value)
        {
            _animator.SetInteger(name, value);
        }
        public void SetLayerWeight(string layerName,float weight) 
        {
            int index= _animator.GetLayerIndex(layerName);
            _animator.SetLayerWeight(index,weight);
        }

        public void PlayCustomSkill(AnimationClip clip) 
        {
            _role.WeaponManager.CurrentWeapon.Config.Controller["Attack01"] = clip;
        }
       
    }
}
